<template>
  <view class="container">
    <web-view src="http://127.0.0.1:5500/index.html" />
    <view class="ul">
      <scroll-view scroll-y>
        <view class="tools">
          <view class="daochu">导出</view>
        </view>
        <view v-for="(item, index) in list" :key="index" class="li">
          <view class="xh">{{ index + 1 }}.</view>
          <view
            v-for="(item1, index1) in item.context"
            :key="index1"
            class="text"
          >
            <rich-text :nodes="format(item1.text, item1.keyword)"></rich-text>
          </view>
        </view>
      </scroll-view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const format = (e: string, keyword: string) => {
  const res = e.replaceAll(
    keyword,
    `<span style="font-size: 1rem; font-weight: 700; color: #E63946;">${keyword}</span>`,
  )
  return res
}

const list = ref<
  Array<{
    id: number
    context: Array<{
      text: string
      keyword: string
    }>
  }>
>([
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
  {
    id: 1,
    context: [
      {
        text: '全军首领用统帅',
        keyword: '统帅',
      },
      {
        text: '统辖率领用统率',
        keyword: '统率',
      },
    ],
  },
])
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10px;

  .ul {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 10px;
    .tools {
      width: 100%;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      padding: 20rpx;

      .daochu {
        width: 150rpx;
        height: 65rpx;
        background-color: #2878ff;
        border-radius: 10rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
      }
    }

    .li {
      width: 100%;
      height: 100rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;

      .xh {
        position: absolute;
        left: 10px;
      }

      .text {
        margin: 0 10px;
        color: #212121;
        font-size: 0.9rem;
      }
    }
  }
}
</style>
